package com.situ.day12.exception;

public class AccountAdmin {
	// 余额（当前账号有多少钱）
	private Double balance;
	// 账号
	private Integer number;

	public AccountAdmin(Integer number) {
		balance = 0.0;
		this.number = number;
	}

	// 存钱 deposite
	public void deposite(double amount) {
		balance = balance + amount;
	}

	// 取钱withdraw
	public void withdraw(double amount) throws MeiQianException {
		if (amount <= balance) {
			balance = balance - amount;
		} else {
			double need = amount - balance;
			throw new MeiQianException(need);
		}
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}
}
